package de.tabuma.lib;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

/**
 * Interface that is integrated into all &quot;viewable&quot; classes.
 * This is a part of the integration of the model-view-control pattern.
 * @author $Author: alefen $
 * @version $Revision: 1.2 $
 * @since $Date: 2009/07/21 19:36:01 $
 */
public abstract class tabumaview {

    public tabumaview(String servlet, Hashtable parameter) {
        this.servlet = servlet;
        this.parameter = parameter;
    }

    String servlet;
    public String getServlet() {
        return this.servlet;
    }
    public void setServlet(String servlet) {
        this.servlet = servlet;
    }

    Hashtable parameter;
    public Hashtable getParameter() {
        return this.parameter;
    }

    public void setParameter(Hashtable parameter) {
        this.parameter = parameter;
    }

    public abstract void processRequest(ServletContext context, HttpServletRequest request, HttpServletResponse response,PrintWriter out);

    public String getLinkAsAttribute() {
        return view.getLinkAsAttribute(parameter);
    }

    public String getHiddenAsAttribute() {
        return view.getHiddenAsAttribute(parameter);
    }

    public String getFormBeginn(String linkName) {
        return view.getFormBeginn(servlet, linkName);
    }

    public String getFormEnd() {
        return view.getFormEnd();
    }


    public static String printHiddenField(String key, String value) {
       return view.printHiddenField(key, value);
    }

    public static String printInputField(String key, String value) {
        return view.printInputField(key, value, null);
    }

    public static String printForm1(String key, String keyField, String value) {
        return view.printForm1(key, keyField, value);
    }

    public static String printForm2(String key, String keyField, String value) {
        return view.printForm2(key, keyField, value);
    }

    public static String getContentHeader(String contentHeader) {
        return view.getContentHeader(contentHeader);
    }
}